<template>
  <div class="view">
    <div class="title">排行榜</div>
    <div v-for="(item,index) in info" class="rank-item" @mouseover="mouseOver(index)" @mouseleave="mouseLeave"
         :class="{active:index==isActive}" @click="click" type="a">
      <div class="index" :class="{special:index<3}">{{index+1}}</div>
      <div class="name">{{item.name}}</div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "Special",
    data() {
      return {
        info: [
          {name: "辉夜大小姐想让我告白？~天才们的恋爱头脑战~"},
          {name: "刀剑神域 爱丽丝篇 异界战争-终章-"},
          {name: "炎炎消防队 贰之章"},
          {name: "魔物娘的医生"},
          {name: "公主连结Re：Dive"},
          {name: "名侦探柯南"},
          {name: "神之塔"},
          {name: "格莱普尼尔"},
          {name: "宝石幻想 光芒重现"},
          {name: "转生成为了只有乙女游戏破灭Flag的邪恶大小姐"},
        ],
        isActive:-1
      }
    },
    methods:{
      mouseOver(index){
        this.isActive=index
      },
      mouseLeave(){
        this.isActive=-1
      },
      click(){

      }
    }
  }
</script>

<style scoped>
  .view {
    width: 400px;
    margin-left: 20px;
  }

  .rank-item {
    display: flex;
    margin-bottom: 20px;
    cursor: pointer;
    flex: 0 0 80%;
  }

  .name {
    font: 24px "宋体";
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 70%;
  }

  .index {
    font: 24px "宋体";
    color: gray;
  }

  .special{
    background-color: deepskyblue;
    color: white;
  }

  .title {
    font: 30px "宋体";
    font-weight: 800;
    height: 36px;
    line-height: 36px;
    margin-bottom: 16px;
    align-items: center;
    margin-top: 10px;
  }
  .active{
    color: deepskyblue;
  }
</style>